package com.tc.utils.image.table;

import java.awt.*;
import java.awt.geom.Rectangle2D;

/**
 * Created by Frederic.Tang on 2018/8/23.
 */
public class TableCell {
    String text;
    int fw,fh;
    int w,h;

    int x,y;
    protected TableCell(String text){
        this.text=text;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public void calc(Graphics2D g) {
        FontMetrics fm = g.getFontMetrics();
        Rectangle2D size = fm.getStringBounds(text, g);
        fw = (int) size.getWidth();
        fh = (int) size.getHeight();
        w=fw+2*Table.padx;
        h=fh+2*Table.pady;

        System.out.println("w="+w+",h="+h);

    }
}
